﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lottery.MediaData.Core {
    public class CellData {
        public CellData() {
            InitData();
        }

        private void InitData() {
            m_data = new List<List<string>>();
            for (int i = 0; i < 15; i++) {
                var row = new List<string>();
                for (int j = 0; j < 15; j++) {
                    row.Add(string.Empty);
                }
                m_data.Add(row);
            }

            m_low = new List<string>();
            m_up = new List<string>();
            for (int i = 0; i < RowCount; i++) {
                m_low.Add(string.Empty);
                m_up.Add(string.Empty);
            }
        }

        private List<List<string>> m_data;

        public string this[int col, int row] {
            get {
                return m_data[row][col];
            }

            set {
                m_data[row][col] = value;
            }
        }

        private List<string> m_low;
        private List<string> m_up;

        /// <summary>
        /// 获得A列的选中值
        /// </summary>
        /// <param name="row">行</param>
        /// <returns></returns>
        public string GetRowLow(int row) {
            return m_low[row];
        }

        public void SetRowLow(int row, string low) {
            m_low[row] = low;
        }

        public string GetRowUp(int row) {
            return m_up[row];
        }

        public void SetRowUp(int row, string up) {
            m_up[row] = up;
        }

        public int RowCount { get { return 15; } }

        public int ColCount { get { return 15; } }

        public int GetSum(int row) {
            try {
                return Convert.ToInt32(this[ColCount - 1, row]);
            } catch {
            }
            return 0;
        }
    }
}
